Skip to main content

All Questions

Tagged with
0votes
1answer
58views

replace any in txt file excipt range of letters

Please I have a txt file, I want to replace anything to _ except this range of letters [\0600-\06FF]. like sed 's/^[\0600-\06FF]/_/g' < a. txt > b. txt not work with me.
lina32's user avatar
1vote
1answer
73views

Replace each letter in a .txt with the letter six positions later

I want to "encrypt" a .txt by replacing each letter with the letter six positions later. What I have right now is: tr [:alpha:] ??? < myfile.txt But I don't know what to put in ??? ... Any help ...
Jiménez's user avatar
7votes
1answer
983views

Is it possible to replace duplicates of a character with one character using tr

I'm trying to take all occurrences of # and if they are consecutive replace them with just one #. e.g. ab ### cde fghi## jklm would become: ab # cde, fghi# jklm My initial goal was to replace all ...
user652437's user avatar
1vote
1answer
4kviews

How to replace double new line with single using tr?

Given a text, $ cat a.txt Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at magna sed libero accumsan ultrices. Proin varius tortor risus, at pulvinar quam auctor vitae. Etiam iaculis ...
Abdillah's user avatar
17votes
2answers
73kviews

Fastest & Most Core way to replace "\r\n" with "\n" in a file?

I suppose tr is a more core method and thus probably a faster way to replace things within a given file. However tr can only replace equal amounts of characters. meaning... 2 characters can only be ...
user73235's user avatar
5votes
3answers
1kviews

how to emulate "replace a b b a" with a sed?

I am trying to emulate a replace command which swaps two characters, with a sed script, but the obvious choice: sed -e 's/a/b/g' -e 's/b/a/g' does no work. Can you point me how to do it correctly?
Mitten's user avatar

close